/**
 * @Description:
 * @Author: saqqdy
 * @LastEditors: saqqdy
 * @Date: 2021-07-18 00:39:35
 * @LastEditTime: 2021-07-18 12:31:51
 */
import 'antd/dist/antd.less'

import React, { Fragment, Suspense, lazy } from 'react'
import { Link, NavLink, Route, BrowserRouter as Router, Switch } from 'react-router-dom'
import { ConfigProvider, DatePicker, message } from 'antd'
import zhCN from 'antd/lib/locale/zh_CN'

import { stylesContainer } from './app.module.less'
import { stylesHeader, stylesImage } from './app.module.scss'

const LazyStrawberryIcon = lazy(() => import('./strawberry'))

const mapStateToProps = state => ({
    login: state.login
})

const mapDispatchToProps = dispatch => ({
    loginApi: payload => {
        login(payload)(dispatch)
    }
})

// @withRouter
// @connect(mapStateToProps, mapDispatchToProps)
export const App = (): React.ReactElement => (
    <ConfigProvider locale={zhCN}>
        {/* <Fragment>
            <Router>
                <Switch> */}
                    <div className={stylesContainer}>
                        <div className={stylesHeader}>It works!!!!</div>
                        <DatePicker />
                        <Suspense fallback={'loading...'}>
                            <LazyStrawberryIcon className={stylesImage} />
                        </Suspense>
                    </div>
                {/* </Switch>
            </Router>
        </Fragment> */}
    </ConfigProvider>
)

// @withRouter
// @connect(mapStateToProps, mapDispatchToProps)
// export default class MyApp extends React.Component {
//     render() {
//         return (
//             <Fragment>
//                 <Router>
//                     <Switch>
//                         // 里面可以写自己的页面
//                     </Switch>
//                 </Router>
//             </Fragment>
//         );
//     }
// }
